package com.yunkeji.api.user.controller;

import com.yunkeji.api.user.bo.DataCountBo;
import com.yunkeji.api.user.service.AppUserAnalyseService;
import com.yunkeji.api.user.vo.CountVo;
import com.yunkeji.api.user.vo.FriendsCount;
import com.yunkeji.api.user.vo.MsgCount;
import com.yunkeji.api.user.vo.OnlineCountVo;
import com.yunkeji.common.core.controller.BaseController;
import com.yunkeji.common.core.domain.R;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户相关接口-统计
 *
 * @author 老张
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/v1/user")
public class AppUserAnalyseController extends BaseController {

    private final AppUserAnalyseService appUserAnalyseService;

    /**
     * 统计-我关注的-关注我的
     *
     * @author 老张
     */
    @PostMapping("/friendsCount")
    public FriendsCount friendsCount() {
        return appUserAnalyseService.friendsCount();
    }

    /**
     * 个人中心数据统计
     *
     * @author 老张
     */
    @PostMapping("/dataCount")
    public R<CountVo> todayCount(@RequestBody DataCountBo bo) {
        CountVo countVo = appUserAnalyseService.todayCount(bo);
        return R.ok(countVo);
    }

    /**
     * 消息中心统计
     *
     * @author 老张
     */
    @PostMapping("/msgCount")
    public R<MsgCount> msgCount() {
        MsgCount countVo = appUserAnalyseService.msgCount();
        return R.ok(countVo);
    }

    /**
     * 对立性别的在线人数
     *
     * @author 老张
     */
    @PostMapping("/onlineCount")
    public R<OnlineCountVo> onlineCount() {
        OnlineCountVo countVo = appUserAnalyseService.onlineCount();
        return R.ok(countVo);
    }
}
